
import Koa from 'koa';
import router from './router.js';
import koaStatic from 'koa-static';
import {getPath} from './utils/index.js';
import {runTask} from './utils/task.js'

// 跑定时任务
runTask();

// 创建koa和router对象
const app = new Koa();

// 绑定端口号3000
const {rootPath, path}  = getPath();
const staticPath = path.join(rootPath, 'public');
app.use(router.routes()).use(koaStatic(staticPath)).listen(80)
console.log('启动成功：http://localhost:80');



